/**
 * ClassName GenericsDemo
 * Description TODO
 * Author Hexiao
 * Date 2018/8/23 10:58
 * Version 1.0
 **/
public class GenericsDemo {
//    泛型上限
    public static void fun(Info<?extends Object> temp){//// 只能接收Object及其Object的子类  
        System.out.println(temp);
    }
//public static void fun(Info<?extends String> temp){//不兼容的类型: Info<java.lang.Integer>无法转换为Info<? extends java.lang.String>
//    System.out.println(temp);
//}
//    泛型下限
//    public static void fun2(Info<?super String> temp) {  // 只能接收String或Object类型的泛型
//     System.out.print(temp + "、");
//    }

    public static void main(String[] args){
        Info<String> i1=new Info<String>();// 声明String的泛型对象
        Info<Integer> i2=new Info<Integer>();// 声明Integer的泛型对象
        i1.setVar("hello");
        i2.setVar(1);
        fun(i1);
        fun(i2);
    }

};